@import "mixins/mixins";
@import "common/var";

@include b(textarea) {
  display: inline-block;
  width: 100%;
  vertical-align: bottom;
  font-size: $--font-size-base;

  @include e(inner) {
    display: block;
    resize: vertical;
    padding: 5px 15px;
    line-height: 1.5;
    box-sizing: border-box;
    width: 100%;
    font-size: inherit;
    color: $--input-color;
    background-color: $--input-fill;
    background-image: none;
    border: $--input-border;
    border-radius: $--input-border-radius;
    transition: $--border-transition-base;

    &::placeholder {
      color: $--input-placeholder-color;
    }

    &:hover {
      border-color: $--input-hover-border;
    }

    &:focus {
      outline: none;
      border-color: $--input-focus-border;
    }
  }

  @include when(disabled) {
    .el-textarea__inner {
      background-color: $--input-disabled-fill;
      border-color: $--input-disabled-border;
      color: $--input-disabled-color;
      cursor: not-allowed;

      &::placeholder {
        color: $--input-disabled-placeholder-color;
      }
    }
  }
}

@include b(input) {
  position: relative;
  font-size: $--font-size-base;
  display: inline-block;
  width: 100%;
  background-color: $--input-fill;
  @include scroll-bar;

  & .el-input__clear {
    color: $--input-icon-color;
    font-size: $--input-font-size;
    line-height: 16px;
    cursor: pointer;
    transition: $--color-transition-base;

    &:hover {
      color: $--input-clear-hover-color;
    }
  }

  @include e(center) {
    flex: 1;
    overflow:hidden;
    display: inline;
  }

  @include e(inner) {
    -webkit-appearance: none;
    background-color: $--input-fill;
    background-image: none;
    border-radius: $--input-border-radius;
    border: $--input-border;
    box-sizing: border-box;
    color: $--input-color;
    display: inline-block;
    font-size: inherit;
    height: $--input-height;
    line-height: $--input-height;
    outline: none;
    padding: 0 25px;
    transition: $--border-transition-base;
    width: 100%;

    &::placeholder {
      color: $--input-placeholder-color;
    }

    &:hover {
      //border-color: $--input-hover-border;
    }

    &:focus {
      outline: none;
      //border-color: $--input-focus-border;
    }
  }

  @include e(suffix) {
    position: absolute;
    height: 100%;
    right: 5px;
    top: 0;
    text-align: center;
    color: $--input-icon-color;
    transition: all .3s;
    pointer-events: none;
  }

  @include e(suffix-inner) {
    pointer-events: all;
  }

  @include e(prefix) {
    position: absolute;
    height: 100%;
    left: 0;
    top: 0;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: $--input-icon-color;
    transition: all .3s;
    border-right: 1px solid $--border-color-base;
    padding: 0 16px;
  }

  @include e(icon) {
    height: 100%;
    width: 25px;
    text-align: center;
    transition: all .3s;
    line-height: $--input-height;

    &:after {
      content: '';
      height: 100%;
      width: 0;
      display: inline-block;
      vertical-align: middle;
    }
  }

  @include e(validateIcon) {
    pointer-events: none;
  }

  @include when(active) {
    .el-input__inner {
      outline: none;
      border-color: $--input-focus-border;
    }
  }

  @include when(disabled) {
    .el-input__inner {
      background-color: $--input-disabled-fill;
      border-color: $--input-disabled-border;
      color: $--input-disabled-color;
      cursor: not-allowed;

      &::placeholder {
        color: $--input-disabled-placeholder-color;
      }
    }

    .el-input__icon {
      cursor: not-allowed;
    }
  }

  @include m(suffix) {
    .el-input__inner {
      padding-right: 30px;
    }
  }

  @include m(prefix) {
    .el-input__inner {
      padding-left: 88px;
    }
  }

  @include m(medium) {
    font-size: $--input-medium-font-size;

    @include e(inner) {
      height: $--input-medium-height;
      line-height: $--input-medium-height;
    }

    .el-input__icon {
      line-height: $--input-medium-height;
    }
  }
  @include m(small) {
    font-size: $--input-small-font-size;

    @include e(inner) {
      height: $--input-small-height;
      line-height: $--input-small-height;
    }

    .el-input__icon {
      line-height: $--input-small-height;
    }
  }
  @include m(mini) {
    font-size: $--input-mini-font-size;

    @include e(inner) {
      height: $--input-mini-height;
      line-height: $--input-mini-height;
    }

    .el-input__icon {
      line-height: $--input-mini-height;
    }
  }
}

@include b(input-group) {
  line-height: normal;
  display: flex;
  width: 100%;
  border-collapse: separate;
  border: $--border-base;
  border-radius: $--input-border-radius;
  background-color: $--input-fill;
  transition: box-shadow .3s ease-out;

  .el-input__inner {
    vertical-align: middle;
    display: table-cell;
    box-sizing: border-box;
    overflow: hidden;
    border: none;
  }

  @include when(focused) {
    border-color: transparent;
    @include utils-shadow-transition(0px 12px 32px 0px rgba(0, 0, 0, 0.12));

    background-color: $--input-focused-fill;
    .el-input__inner {
      background-color: $--input-focused-fill;
      font-weight: bold;
    }
  }

  @include e((append, prepend)) {
    //background-color: $--background-color-base;
    color: $--color-info;
    vertical-align: middle;
    //display: table-cell;
    position: relative;
    //padding: 0 20px;
    padding: 0 10px;
    margin: 5px 0;
    white-space: nowrap;
    display: flex;
    justify-content: center;
    align-items: center;

    .svg-icon {
      fill: $--color-gray;
    }

    &:focus {
      outline: none;
    }

    //.el-select,
    //.el-button {
    //  display: inline-block;
    //  margin: -10px -20px;
    //}

    //button.el-button,
    //div.el-select .el-input__inner,
    //div.el-select:hover .el-input__inner {
    //  border-color: transparent;
    //  background-color: transparent;
    //  color: inherit;
    //  border-top: 0;
    //  border-bottom: 0;
    //}
    //
    //.el-button,
    //.el-input {
    //  font-size: inherit;
    //}
  }

  @include when(focused) {
    border-color: transparent !important;
    @include utils-shadow-transition(0px 12px 32px 0px rgba(0, 0, 0, 0.12));

    background-color: $--input-focused-fill;
    .el-input__inner {
      background-color: $--input-focused-fill;
      font-weight: bold;
    }

    @include e((append, prepend)) {
      .svg-icon {
        fill: $--color-dark;
      }
    }
  }

  @include e(prepend) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: $--border-base;
    padding: 0 20px;
  }

  @include e(append) {
    border-left: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  @include m(prepend) {
    .el-input__inner {
      border-top-left-radius: 0;
      border-bottom-left-radius: 0;
      border: 0;
    }
    .el-select .el-input.is-focus .el-input__inner {
      border-color: transparent;
    }
  }

  @include m(append) {
    .el-input__inner {
      border-top-right-radius: 0;
      border-bottom-right-radius: 0;
    }
    .el-select .el-input.is-focus .el-input__inner {
      border-color: transparent;
    }
  }
}

/** disalbe default clear on IE */
.el-input__inner::-ms-clear {
  display: none;
  width: 0;
  height: 0;
}
